\documentclass[a4paper,UTF8]{article}
\usepackage{ctex}
\usepackage{tikz}
\begin{document}
	\begin{tikzpicture}
		
		% 画坐标系
		\draw (0,-6) [->, thick]-- (0,12) node (yaxis) [above] {y};
		
		\draw (0,0) [->, thick]-- (9,0) node (yaxis) [above] {x};
		\foreach \x/\y in {1/1,2/2,3/1,4/-2,5/1,6/2,7/1,8/-2,9/1} {
			\fill (\x,\y) circle (2pt);
		}
		
		\foreach \x in {1,2,3,4,5,6,7,8,9}{
			\node at (\x,0) [below] {\x};
		}
		\foreach \x in {1,2,3,4,5}{
			\draw (\x,0) -- (\x, 2pt);
		}	
		\foreach \y in {-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12}{
			\node at (0,\y) [left] {\y};
			\draw (0,\y) -- (2pt,\y);
		}
		\foreach \y in {-3,-2,-1,1,2,3}{
			
		}
		
		
		\foreach \s/\e/\d/\c/\b/\a in {
			1/2/1/1.268041237113402/0/-0.26804123711340205,
			2/3/2/0.463917525773196/-0.8041237113402062/-0.6597938144329897,
			3/4/1/-3.1237113402061856/-2.783505154639175/2.9072164948453607,
			4/5/-2/0.030927835051546726/5.9381443298969065/-2.9690721649484533,
			5/6/1/3/-2.9690721649484533/0.9690721649484534,
			6/7/2/-0.030927835051546282/-0.06185567010309301/-0.9072164948453607,
			7/8/1/-2.8762886597938144/-2.783505154639175/2.6597938144329896,
			8/9/-2/-0.463917525773196/5.195876288659794/-1.731958762886598
		}{
			% 分段函数
			\draw [blue,smooth,domain=\s:\e] plot function {\d+\c*(x-\s)+\b*(x-\s)**2+\a*(x-\s)**3};
			% 一阶导数
			\draw [green,smooth,domain=\s:\e] plot function {\c+\b*2*(x-\s)+\a*3*(x-\s)**2};
			% 二阶导数
			\draw [red,smooth,domain=\s:\e] plot function {2*\b+6*\a*(x-\s)};
		}
		
	\end{tikzpicture}
\end{document}